<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring框架核心解决方案</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            border-color: #667eea;
        }
        
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 12px;
            overflow: hidden;
            position: relative;
        }
        
        .code-header {
            background: #2d2d2d;
            padding: 8px 16px;
            font-size: 12px;
            color: #888;
            border-bottom: 1px solid #3e3e3e;
        }
        
        pre {
            margin: 0;
            padding: 16px;
            overflow-x: auto;
            font-family: 'Consolas', 'Monaco', monospace;
            font-size: 14px;
            line-height: 1.6;
        }
        
        .section-number {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-weight: 700;
            font-size: 3rem;
            margin-right: 1rem;
        }
        
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            margin-top: -0.2rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        
        .mermaid {
            background: white;
            padding: 2rem;
            border-radius: 12px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        }
        
        .feature-icon {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 24px;
            margin-bottom: 1rem;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center animate-fadeInUp">
            <h1 class="text-5xl md:text-6xl font-bold mb-6">
                Spring框架核心解决方案
            </h1>
            <p class="text-xl md:text-2xl mb-8 opacity-90">
                构建灵活、可维护、高效的企业级应用程序
            </p>
            <div class="flex justify-center space-x-4">
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full text-sm">
                    <i class="fas fa-code mr-2"></i>依赖注入
                </span>
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full text-sm">
                    <i class="fas fa-layer-group mr-2"></i>AOP编程
                </span>
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full text-sm">
                    <i class="fas fa-database mr-2"></i>数据访问
                </span>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 px-6">
        <div class="max-w-4xl mx-auto bg-white rounded-2xl shadow-xl p-8 md:p-12">
            <p class="text-lg leading-relaxed text-gray-700">
                <span class="drop-cap">S</span>pring框架通过其全面的功能支持，解决了从依赖注入、面向切面编程、事务管理到数据访问、Web开发、安全管理、配置管理、缓存等多个方面的问题。通过这些解决方案，Spring帮助开发者构建更加灵活、可维护和高效的应用程序。
            </p>
        </div>
    </section>

    <!-- Architecture Diagram -->
    <section class="py-8 px-6">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">Spring框架架构全景</h2>
            <div class="mermaid">
                graph TB
                    A[Spring Framework] --> B[核心容器]
                    A --> C[AOP]
                    A --> D[数据访问]
                    A --> E[Web]
                    A --> F[其他]
                    
                    B --> B1[依赖注入]
                    B --> B2[Bean管理]
                    
                    C --> C1[切面编程]
                    C --> C2[事务管理]
                    
                    D --> D1[JDBC]
                    D --> D2[ORM]
                    D --> D3[Spring Data]
                    
                    E --> E1[Spring MVC]
                    E --> E2[RESTful]
                    
                    F --> F1[Spring Security]
                    F --> F2[缓存管理]
                    F --> F3[配置管理]
                    
                    style A fill:#667eea,stroke:#764ba2,stroke-width:3px,color:#fff
                    style B fill:#4facfe,stroke:#00f2fe,stroke-width:2px,color:#fff
                    style C fill:#fa709a,stroke:#fee140,stroke-width:2px,color:#fff
                    style D fill:#30cfd0,stroke:#330867,stroke-width:2px,color:#fff
                    style E fill:#a8edea,stroke:#fed6e3,stroke-width:2px,color:#333
                    style F fill:#ffecd2,stroke:#fcb69f,stroke-width:2px,color:#333
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <section class="py-16 px-6">
        <div class="max-w-6xl mx-auto grid gap-8">
            
            <!-- 1. 依赖注入 -->
            <div class="bg-white rounded-2xl shadow-lg p-8 card-hover">
                <div class="flex items-start">
                    <span class="section-number">1</span>
                    <div class="flex-1">
                        <h3 class="text-2xl font-bold mb-4 text-gray-800">依赖注入（Dependency Injection, DI）</h3>
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-red-50 rounded-lg p-4">
                                <h4 class="font-semibold text-red-700 mb-2">
                                    <i class="fas fa-exclamation-triangle mr-2"></i>问题
                                </h4>
                                <p class="text-gray-700">组件之间的依赖关系管理复杂，耦合度高，难以测试和维护。</p>
                            </div>
                            <div class="bg-green-50 rounded-lg p-4">
                                <h4 class="font-semibold text-green-700 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>解决方案
                                </h4>
                                <p class="text-gray-700">Spring的依赖注入（DI）机制可以通过构造器注入、setter注入等方式自动管理组件之间的依赖关系，降低耦合度，提高代码的可测试性和可维护性。</p>
                            </div>
                        </div>
                        <div class="code-block">
                            <div class="code-header">
                                <i class="fab fa-java mr-2"></i>Java
                            </div>
                            <pre><code>@Component
public class MyService {
    private final MyRepository repository;

    @Autowired
    public MyService(MyRepository repository) {
        this.repository = repository;
    }

    //业务逻辑
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 2. AOP -->
            <div class="bg-white rounded-2xl shadow-lg p-8 card-hover">
                <div class="flex items-start">
                    <span class="section-number">2</span>
                    <div class="flex-1">
                        <h3 class="text-2xl font-bold mb-4 text-gray-800">面向切面编程（Aspect-Oriented Programming, AOP）</h3>
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-red-50 rounded-lg p-4">
                                <h4 class="font-semibold text-red-700 mb-2">
                                    <i class="fas fa-exclamation-triangle mr-2"></i>问题
                                </h4>
                                <p class="text-gray-700">日志记录、事务管理、安全控制等横切关注点在多个地方重复代码，难以管理。</p>
                            </div>
                            <div class="bg-green-50 rounded-lg p-4">
                                <h4 class="font-semibold text-green-700 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>解决方案
                                </h4>
                                <p class="text-gray-700">Spring AOP允许将这些横切关注点从业务逻辑中分离出来，通过定义切面（Aspect）和通知（Advice）来集中管理。</p>
                            </div>
                        </div>
                        <div class="code-block">
                            <div class="code-header">
                                <i class="fab fa-java mr-2"></i>Java
                            </div>
                            <pre><code>@Aspect
@Component
public class LoggingAspect {
    @Before("execution(* com.example.service.*.*(..))")
    public void logBeforeMethod(JoinPoint joinPoint) {
        System.out.println("Before method: " + joinPoint.getSignature().getName());
    }
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 3. 事务管理 -->
            <div class="bg-white rounded-2xl shadow-lg p-8 card-hover">
                <div class="flex items-start">
                    <span class="section-number">3</span>
                    <div class="flex-1">
                        <h3 class="text-2xl font-bold mb-4 text-gray-800">事务管理</h3>
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-red-50 rounded-lg p-4">
                                <h4 class="font-semibold text-red-700 mb-2">
                                    <i class="fas fa-exclamation-triangle mr-2"></i>问题
                                </h4>
                                <p class="text-gray-700">需要确保数据库操作的原子性和一致性，手动管理事务复杂且容易出错。</p>
                            </div>
                            <div class="bg-green-50 rounded-lg p-4">
                                <h4 class="font-semibold text-green-700 mb-2">
                                    <i class="fas fa-check-circle mr-2"></i>解决方案
                                </h4>
                                <p class="text-gray-700">Spring提供了声明式事务管理，通过注解或XML配置来自动管理事务的开始、提交和回滚，简化了事务管理。</p>
                            </div>
                        </div>
                        <div class="code-block">
                            <div class="code-header">
                                <i class="fab fa-java mr-2"></i>Java
                            </div>
                            <pre><code>@Service
public class MyService {

    @Transactional
    public void performTransactionalOperation() {
        //业务逻辑
    }
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 4. 数据访问 -->
            <div class="bg-white rounded-2xl shadow-lg p-8 card-hover">
                <div class="flex items-start">
                    <span class="section-number">4</span>
                    <div class="flex-1">
                        <h3 class="text-2xl font-bold mb-4 text-gray-800">数据访问和持久化</h3>
                        <div class="grid md:grid-cols-2 gap-6 mb-6">
                            <div class="bg-red-50 rounded-lg p-4">
                                